package com.fenghongzhang.day013;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Handler;
import android.util.Log;
import android.widget.ImageView;


public class MyReceiver2 extends BroadcastReceiver {

    private Handler handler;
    private ImageView imageView;

    public MyReceiver2() {
    }

    public MyReceiver2(Handler handler, ImageView imageView) {
        this.handler = handler;
        this.imageView = imageView;
    }

    private static final String TAG = "MyReceiver2";
    @Override
    public void onReceive(Context context, Intent intent) {

        Log.i(TAG, "onReceive: 22222");

        handler.post(new Runnable() {
            @Override
            public void run() {
                imageView.setImageResource(R.drawable.ic_launcher_background);
            }
        });


    }
}
